<template>
	<view class="homePage">
		<view class="homePage-title"></view>
		<view class="bb">
			<view class="deviceBox" v-for="(item,index) in platformData" :key="index">
				<view class="content">
					<view class="icon-title" v-show="privileges.includes(item.role)">{{item.title}}</view>
					<view class="icon-content">
						<view class="icon-item" v-for="value,index2) in item.children" v-show="buttonPrivileges.includes(value.role)"  @click="toPage(value, item.title)" :key="index2">
							<view class="point">
								<image class="icon-img" :src="value.imgUrl" mode=""></image>
							</view>
							<view class="name">{{ value.title }}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import platformData from './platform.js'
	import { mapGetters } from "vuex"
	export default {
		computed: {
			...mapGetters(['buttonPrivileges']),
			...mapGetters(['privileges'])
		},
		data() {
			return {
				platformData
			}
		},
		methods: {
			toPage(obj, title) {
				console.log(obj, title, '入参')
				let page = obj.page
				uni.navigateTo({ url: page })

			},
		}
	}
</script>

<style lang="scss" scoped>
	page {
		height: 100%;
		width: 100%;
	}

	body {
		width: 100%;
		height: 100%;
	}

	.homePage {
		box-sizing: border-box;
		position: relative;
		background-color: #F5F7FA;
		width: 100%;
		padding-bottom: 140rpx;
		height: calc(100vh - 100rpx);
	/* #ifdef MP-WEIXIN */
		padding-bottom: 60rpx;
		height: calc(100vh - 0rpx);
	/* #endif */
	}

	.homePage-title {
		display: flex;
		height: 360rpx;
		background-color: #2F80ED;
		padding: 0rpx 32rpx;
	}

	.deviceBox {
		padding: 0rpx 32rpx;
		margin-top: 30rpx;

		.content {
			background-color: #fff;
			box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(47, 128, 237, 0.2500);
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			width: 100%;
		}

		.icon-title {
			font-size: 36rpx;
			font-weight: bold;
			color: #223247;
			margin-left: 32rpx;
			padding: 28rpx 0rpx;
		}

		.icon-content {
			margin-top: 15rpx;
			display: flex;
			flex-wrap: wrap;

			.icon-item {
				text-align: center;
				width: 25%;

				.icon-img {
					width: 100rpx;
					height: 88rpx;
				}

				.name {
					font-size: 28rpx;
					font-weight: bold;
					color: #445469;
					margin-top: 10rpx;
					margin-bottom: 30rpx;
				}
			}
		}
	}
	.bb {
		margin-top: -220rpx;
		/* #ifdef MP-WEIXIN */
		margin-top: -180rpx;
		/* #endif */
		.active {
			margin-top: 0 !important;
		}
	}
</style>